Skip to content

[3.14] gh-80937: Fix memory leak in tkinter createcommand (GH-152294)#152328

Merged
serhiy-storchaka merged 1 commit into
python:3.14from
miss-islington:backport-bbf7786-3.14
Jun 26, 2026
Merged

[3.14] gh-80937: Fix memory leak in tkinter createcommand (GH-152294)#152328
serhiy-storchaka merged 1 commit into
python:3.14from
miss-islington:backport-bbf7786-3.14

Conversation

@miss-islington

@miss-islington miss-islington commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

A command created with createcommand() held a strong reference to the
interpreter, forming an uncollectable cycle (interpreter -> command ->
interpreter) that kept the interpreter and the callback alive until the
command was removed with deletecommand() or destroy(). The command now
borrows the reference; it cannot outlive the interpreter, which deletes its
commands when finalized.
(cherry picked from commit bbf7786)

Co-authored-by: Serhiy Storchaka storchaka@gmail.com
Co-authored-by: Claude Opus 4.8 noreply@anthropic.com

…2294)

A command created with createcommand() held a strong reference to the
interpreter, forming an uncollectable cycle (interpreter -> command ->
interpreter) that kept the interpreter and the callback alive until the
command was removed with deletecommand() or destroy().  The command now
borrows the reference; it cannot outlive the interpreter, which deletes its
commands when finalized.
(cherry picked from commit bbf7786)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) June 26, 2026 18:55
@serhiy-storchaka serhiy-storchaka merged commit b1679d5 into python:3.14 Jun 26, 2026
49 checks passed
@miss-islington miss-islington deleted the backport-bbf7786-3.14 branch June 26, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants